// +build wireinject
// The build tag makes sure the stub is not built in the final build.

package main

//go:generate wire
import (
	"git.huoys.com/block_chain/mall/configs"
	authSer "git.huoys.com/block_chain/mall/internal/auth/service"
	promoteRpo "git.huoys.com/block_chain/mall/internal/promote/repository"
	promoteSer "git.huoys.com/block_chain/mall/internal/promote/service"
	shopRpo "git.huoys.com/block_chain/mall/internal/shop/repository"
	shopSer "git.huoys.com/block_chain/mall/internal/shop/service"
	userRpo "git.huoys.com/block_chain/mall/internal/user/repository"
	userSer "git.huoys.com/block_chain/mall/internal/user/service"
	"git.huoys.com/block_chain/mall/pkg/database/mysql"
	"git.huoys.com/block_chain/mall/pkg/database/redis"
	"git.huoys.com/block_chain/mall/pkg/log"
	httpSer "git.huoys.com/block_chain/mall/server/http"
	"git.huoys.com/block_chain/mall/server/routers"

	"github.com/google/wire"
)

var providerSet = wire.NewSet(
	configs.NewViper,
	configs.NewLoggerCfg,
	log.NewLogger,
	configs.NewMysqlConfig,
	mysql.NewMysql,
	configs.NewRedisConfig,
	redis.NewRedis,

	promoteRpo.NewRepository,
	promoteSer.NewService,
	userRpo.NewRepository,
	userSer.NewService,
	shopRpo.NewRepository,
	shopSer.NewService,
	authSer.NewTokenService,

	configs.NewServerConfig,
	routers.InitRouter,
	httpSer.NewSrv,
)

func NewApp() (*httpSer.Server, error) {
	panic(wire.Build(providerSet))
}
